{include file="common/head_s"/} 
<style type="text/css"> 
body,html{ background: #fff }
.layui-form-select dl{ max-height: 158px!important }
</style> 
<div class="pd15">
<form class="layui-form layui-form-pane">
    <div class="layui-form-item">
        <label class="layui-form-label">账户类型</label>
        <div class="layui-input-block">
            <select name="name_en" id="name_en" lay-verify="required" lay-filter="name_en">
                <option value="Alipay" {if $info.name_en=="Alipay"} selected=""{/if}>支付宝</option>
                <option value="Wxpay" {if $info.name_en=="Wxpay"} selected=""{/if}>微信</option>
                <option value="Bank" {if $info.name_en=="Bank"} selected=""{/if}>银行卡</option>
            </select>  
        </div>
        <!-- <input type="hidden" name="name" id="name" value="支付宝" lay-verify="required" class="layui-input"> -->
        <input type="hidden" name="id" lay-verify="required" value="{$info.id}">
    </div> 

    <div class="layui-form-item">
        <label class="layui-form-label">账号名称</label>
        <div class="layui-input-block">
            <input type="text" name="bank_name" lay-verify="required" value="{$info.bank_name}" placeholder="银行/微信/支付宝名称" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">收款账号</label>
        <div class="layui-input-block">
            <input type="text" name="bank_no" lay-verify="required" value="{$info.bank_no}" placeholder="银行卡/微信/支付宝账号" class="layui-input">
        </div>
    </div> 

    <div class="layui-form-item" style="text-align: center;width: 100%">
        <input id="qrcode" name="qrcode" type="hidden">
        <div class="layui-upload-drag" id="qrcode_up" style="display: block;">
            <img src="{$info.qrcode}" height=72>
        </div> 
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">备注说明</label>
        <div class="layui-input-block">
            <input type="text" name="content" value="{$info.content}" placeholder="备注|如是银行卡，请填写开户人名" class="layui-input">
        </div>
    </div>
 
    <div class="layui-form-item" style="margin-bottom: 0px!important; text-align: center;">
        <div class="layui-btn layui-btn-primary" id="overbtn">取消退出</div>
        <button type="submit" class="layui-btn" lay-filter="addbtn" lay-submit><i class="layui-icon">&#x1005;</i>立即提交</button>
    </div>
</form> 
</div>
<script src="/static/plugins/layui/layui.js"></script> 
<script>
layui.use(['jquery','form','upload'], function(){
    var $ = layui.jquery ,upload = layui.upload,form = layui.form;   
    form.on('select(name_en)', function(data){
        var name=$("#name_en option:checked").text(); 
        $('#name').val(name);  
    }); 
    //普通图片上传
    upqrcode=upload.render({
        elem: '#qrcode_up'
        ,url: '{:url("Upfiles/upload")}' 
        ,done: function(res){ 
            if(res.code>0){
                $('#qrcode').val(res.url);
                $('#qrcode_up').html("<img src="+res.url+" height=72>");
            }else{ 
                return layer.msg(res.info);
            }
        } 
    });
    // 提交监听
    form.on('submit(addbtn)', function (data) {   
        $.post("{:url('user/financial/editbank')}",data.field,function(res){ 
            if(res.code===1){
                layer.msg(res.msg,{time:2000,icon:1},function(){  
                    parent.location.reload();
                });
            }else{
                layer.msg(res.msg,{time:1000,icon:2}); 
            }
        });
        return false;
    });
    $('#overbtn').on('click', function() {
        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
        parent.layer.close(index); //再执行关闭，强制关闭弹窗
    }); 
}); 
</script> 
</body>
</html>